
@include('Admin.public.head')
<style type="text/css">
    #my-popup2 {
        max-height: 320px;}
    #my-popup {height: auto;}

    .admin-content .am-popup {
        max-height: none;
        border-radius: 4px;
        overflow: hidden;
    }
</style>
<body>
@include('Admin.public.menu')
<div class=" admin-content" id="app">
    {{ csrf_field() }}
    <div class="daohang">
    </div>

    <div class="admin-biaogelist">
        <div class="listbiaoti am-cf">
            <ul class="am-icon-users"> 团队管理</ul>
            <dl class="am-icon-home" style="float: right;">当前位置： 首页 > <a href="#">列表</a></dl>
            <!--这里打开的是新页面-->
        </div>
        <div class="am-btn-toolbars am-btn-toolbar am-kg am-cf">
            <ul>
                <li>
                    <el-input v-model="keyword.keyword" class="keywords" placeholder="关键词搜索"></el-input>
                </li>
                <li>
                    <el-button type="primary" v-on:click="changeClick()">搜索</el-button>
                </li>
                <li> <el-button type="danger" v-on:click="resetOrder()">重置</el-button></li>
            </ul>
        </div>
        <form class="am-form am-g">
            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
                <thead>
                <tr class="am-success">
                    <th class="table-id" style="width: 120px;">姓名</th>
                    <th class="table-title">账号</th>
                    <th class="table-title">团队业绩</th>
                    <th class="table-type">注册时间</th>
                </tr>
                </thead>
                <tbody>
                <tr v-for="val,index in ApplyList">
                    <td>@{{ val.user_name }}</td>
                    <td>@{{ val.name }}</td>
                    <td>@{{ val.super_team_count }}</td>
                    <td class="am-hide-sm-only">@{{ val.enroll_time}}</td>
                </tr>
                </tbody>
            </table>
            <!--分页-->
            <ul class="am-pagination am-fr">
                <div class="block">
                    <el-pagination
                            background
                            :page-size="PagesData.per_page"
                            :current-page = "PagesData.current_page"
                            layout="total , prev, pager, next"
                            :total="PagesData.total"
                            @prev-click="changeClick"
                            @next-click="changeClick"
                            @current-change="changeClick">
                    </el-pagination>
                </div>
            </ul>

        </form>
        <script src="{{ URL::asset('js/address/distpicker.data.js') }}"></script>
        <script src="{{ URL::asset('js/address/distpicker.js') }}"></script>
        <script>
            var app = new Vue({
                el:"#app",
                data: {
                    user_name:'',
                    ApplyList : [], //代理商列表
                    PagesData:[],//分页
                    keyword:{ //关键字搜索
                        type:'',
                        //status:'',
                        keyword:'',
                        // created_at:'',
                    },
                },
                //事件
                methods: {
                    obtain:function (val) {
                        var query = window.location.search.substring(1);
                        var vars = query.split("&");
                        for (var i=0;i<vars.length;i++) {
                            var pair = vars[i].split("=");
                            if(pair[0] == val){
                                return pair[1];
                            }
                        }
                    },

                    //选择当前页
                    changeClick:function(e){
                        var rico = this
                        var uid = this.obtain('uid');
                        $.get("/admin/members/my_team",{'_token':'{{csrf_token()}}',uid:uid,page:e,keyword:app.keyword},function (res) {
                            if(res.code){
                                app.ApplyList = res.data.data
                                app.PagesData = res.data
                            } else {
                                layer.msg(res.data);
                            }
                        });
                    },

                    initialize:function () {
                        var rico = this
                        //代理商列表
                        var uid = this.obtain('uid');
                        $.get("/admin/members/my_team",{'_token':'{{csrf_token()}}',uid:uid},function (res) {
                            if(res.code){
                                app.ApplyList = res.data.data
                                app.PagesData = res.data
                            } else {
                                layer.msg(res.data);
                            }
                        });

                    },

                    //重置
                    resetOrder:function(){

                        location.reload();
                    }
                },

                //自动执行
                mounted: function () {
                    this.initialize();//分公司
                },
            })
        </script>
@include('Admin.public.foot')